﻿<phone:PhoneApplicationPage
    x:Class="Fabrikam.Phone.DetailsEdit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:converters="clr-namespace:Fabrikam.Phone.Converters"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar  >
            <shell:ApplicationBarIconButton IconUri="/Icons/save.png" IsEnabled="True" Text="Edit" Click="ApplicationBarSaveClicked"  />
            <shell:ApplicationBarIconButton IconUri="/Icons/delete.png" IsEnabled="True" Text="Delete" Click="ApplicationBarDeleteClicked" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <phone:PhoneApplicationPage.Resources>

        <converters:DebugConverter x:Key="DebugConverter" />
        <converters:StatusToBrushConverter x:Key="StatusToBrushConverter" />
        <converters:StatusToNameConverter x:Key="StatusToNameConverter" />
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="Assets/Background.png"></ImageBrush>
        </Grid.Background>
        
        <!--Pivot Control-->
        <phone:Pivot Title="FABRIKAM FIBER">
            <!--Pivot item one-->
            <phone:PivotItem Header="customer">
                <ScrollViewer Grid.Row="1" Margin="12,0,12,0">
                    <StackPanel x:Name="ContentPanel" >
                        <TextBlock Text="Customer" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        
                        <toolkit:ListPicker Margin="12,0,12,0" Name="CustomerListPicker"
                                    ItemsSource="{Binding Customers}"
                                    ExpansionMode="FullscreenOnly" SelectionChanged="CustomerListPicker_OnSelectionChanged"
                                    Tag="{Binding Customer, Mode=TwoWay, Converter={StaticResource DebugConverter}}" >
                            
                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding FirstName}" />
                                        <TextBlock Text="{Binding LastName}" Margin="10,0,0,0" />
                                    </StackPanel>
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                            <toolkit:ListPicker.FullModeItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                                        <TextBlock Text="{Binding FirstName}"  FontFamily="{StaticResource PhoneFontFamilyLight}" FontSize="43"  />
                                        <TextBlock Text="{Binding LastName}" Margin="10,0,0,0" FontFamily="{StaticResource PhoneFontFamilyLight}" FontSize="43"  />
                                    </StackPanel>
                                </DataTemplate>
                            </toolkit:ListPicker.FullModeItemTemplate>
                        </toolkit:ListPicker>
                      
                        <TextBlock Text="Address" 
                       TextWrapping="Wrap" Margin="12,24,0,0"
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        
                        <TextBlock Text="Street" TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextTitle2Style}"/>
                        
                        <TextBox Text="{Binding Customer.Address_Street, Mode=TwoWay}" 
                       TextWrapping="Wrap" />


                        <TextBlock Text="Zip" TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextTitle2Style}"/>
                        <TextBox Text="{Binding Address_Zip, Mode=TwoWay}" 
                       TextWrapping="Wrap" />

                        <TextBlock Text="City" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextTitle2Style}"/>
                        <TextBox Text="{Binding Address_City, Mode=TwoWay}" 
                       TextWrapping="Wrap"/>

                        <TextBlock Text="State" TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextTitle2Style}"/>
                        <TextBox Text="{Binding Address_State, Mode=TwoWay}" 
                       TextWrapping="Wrap" />

                    </StackPanel>
                </ScrollViewer>
            </phone:PivotItem>

            <!--Pivot item three-->
            <phone:PivotItem Header="ticket">
                <ScrollViewer Grid.Row="1" Margin="12,0,12,0">
                    <StackPanel >

                        <TextBlock Text="Title" 
                       TextWrapping="Wrap" Margin="12,0,0,0"
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <TextBox Text="{Binding ServiceTicket.Title, Mode=TwoWay}" 
                       TextWrapping="Wrap" />

                        <TextBlock Text="Description" TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <TextBox Text="{Binding ServiceTicket.Description, Mode=TwoWay}" 
                       TextWrapping="Wrap" Height="300" />

                    </StackPanel>
                </ScrollViewer>
            </phone:PivotItem>

            <!--Pivot item two-->
            <phone:PivotItem Header="status">
                <ScrollViewer Grid.Row="1" Margin="12,0,12,0">
                    <StackPanel >
                        <TextBlock Text="Opened" 
                       TextWrapping="Wrap" Margin="12,0,0,0"
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <toolkit:DatePicker Value="{Binding Opened, Mode=TwoWay}" />

                        <TextBlock Text="Closed" TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextTitle2Style}"/>

                        <toolkit:DatePicker Value="{Binding Closed, Mode=TwoWay}" />

                        <TextBlock Text="Status" 
                       TextWrapping="Wrap" Margin="12,24,0,0"
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <toolkit:ListPicker Margin="12,0,12,0" Name="StatusListPicker"
                                    ItemsSource="{Binding AvailableStates}"
                                    ExpansionMode="FullscreenOnly" SelectionChanged="StatusListPicker_OnSelectionChanged">

                            <toolkit:ListPicker.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Rectangle Fill="{Binding Converter={StaticResource StatusToBrushConverter}}" Width="24" Height="24"/>
                                        <TextBlock Text="{Binding Converter={StaticResource StatusToNameConverter}}" Margin="12 0 0 0"/>
                                    </StackPanel>
                                </DataTemplate>
                            </toolkit:ListPicker.ItemTemplate>
                            <toolkit:ListPicker.FullModeItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                                        <Rectangle Fill="{Binding Converter={StaticResource StatusToBrushConverter}}" Width="43" Height="43"/>
                                        <TextBlock Text="{Binding Converter={StaticResource StatusToNameConverter}}" Margin="16 0 0 0"
                                                   FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}" />
                                    </StackPanel>
                                </DataTemplate>
                            </toolkit:ListPicker.FullModeItemTemplate>
                        </toolkit:ListPicker>



                    </StackPanel>
                </ScrollViewer>
            </phone:PivotItem>
        </phone:Pivot>
    </Grid>
    
</phone:PhoneApplicationPage>